#include "ShutdownOS.h"
#include "SystemManagement.h"

#include <signal.h>

namespace CEngine {

#ifdef WINDOWS

#include <Windows.h>

bool windowsShutdown(DWORD signum);
void signalShutdown(int signum);

void
registerSignals(void) {
    signal(SIGTERM, signalShutdown);
    SetConsoleCtrlHandler((PHANDLER_ROUTINE)windowsShutdown, true);
}

void
shutdownOS(int signum) {
    ExitProcess(0);
}

bool
windowsShutdown(DWORD signum) {
    shutdownSystems(signum);
    return true;
}

void
signalShutdown(int signum) {
    shutdownSystems(signum);
}

#endif // WINDOWS

}
